<?php
/**
 * $Id: user_model.php 15 2011-08-14 08:43:26Z zyb0807@gmail.com $
 */
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends CI_Model {

	public function __construct()
	{
		parent::__construct();
	}

	/**
	 * 根据 uid 查询用户
	 */
	public function get_member_by_uid($uid)
	{
		/* 此处查询语句需要修改 */
		$query = $this->db->get_where('members', array('uid' => $uid));
		$userinfo = $query->result();
		$userinfo = !empty($userinfo) ? $userinfo[0] : '';
		return $userinfo;
	}

	/**
	 * 注册新用户
	 */
	public function regiser_user($uid, $username, $password, $email)
	{
		$member = array(
			'uid' => $uid,
			'username' => $username,
			'password' => $password, 
			'email' => $email
		);
		return $this->db->insert('members', $member);
	}
}
